import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Injectable({
  providedIn: 'root',
})
export class HttpService {
  public backendHost = 'https://192.168.164.1:1660';

  constructor(private http: HttpClient) {}

  get(url: string) {
    return this.http.get(this.backendHost + url, {
      observe: 'body',
      responseType: 'json',
    });
  }

  delete(url: string) {
    return this.http.delete(this.backendHost + url, {
      observe: 'body',
      responseType: 'json',
    });
  }

  post(url: string, data: any) {
    return this.http.post(this.backendHost + url, data, {
      observe: 'body',
      responseType: 'json',
    });
  }

  put(url: string, data: any) {
    return this.http.post(this.backendHost + url, data, {
      observe: 'body',
      responseType: 'json',
    });
  }
}
